import Vue from 'vue'

const modulesFiles = require.context('./modules', true, /\.js$/)

modulesFiles.keys().forEach(modulePath => {
  let moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  let install = function(Vue) {
    Vue.directive(moduleName, modulesFiles(modulePath).default)
  }
  Vue.use(install)
})
